﻿using System;
using System.Runtime.CompilerServices;
using UnityEngine;

public static class OutlineDrawer
{
    [CompilerGenerated]
    private static Action<MeshFilter> <>f__am$cache3;
    private static MeshFilter[] drawingMeshFilters;
    private static GameObject lastTarget;
    private static Material outlineMat;

    public static void Draw(GameObject target)
    {
        if (target != null)
        {
            if (outlineMat == null)
            {
                outlineMat = GameResources.OutlineMaterial;
            }
            if (lastTarget != target)
            {
                drawingMeshFilters = target.GetComponentsInChildren<MeshFilter>();
                lastTarget = target;
            }
            if (drawingMeshFilters != null)
            {
                if (<>f__am$cache3 == null)
                {
                    <>f__am$cache3 = v => Graphics.DrawMesh(v.sharedMesh, v.transform.localToWorldMatrix, outlineMat, v.gameObject.layer);
                }
                drawingMeshFilters.Foreach<MeshFilter>(<>f__am$cache3);
            }
        }
    }
}

